package Homework3;

public class Test {
    public static void main(String[] args) {
        Animal a;
        Animal.whoAmI();
        Cat c = new Cat();
        Dog d = new Dog();
        a = c;
        a.whoAmI();
        a.eat();
        a = d;
        a.whoAmI();
        a.eat();
        c.whoAmI();
        d.whoAmI();
    }
}

abstract class Animal {
    abstract void eat();

    static void whoAmI() {
        System.out.println("动物");
    }
}

class Cat extends Animal {
    public void eat() {
        System.out.println("吃鱼");
    }

    static void whoAmI() {
        System.out.println("猫");
    }
}

class Dog extends Animal {
    public void eat() {
        System.out.println("吃骨头");
    }

    static void whoAmI() {
        System.out.println("狗");
    }
}
